package cn.com.sise.service.impl;

import cn.com.sise.dao.ExerciseDao;
import cn.com.sise.pojo.Exercise;
import cn.com.sise.pojo.Question;
import cn.com.sise.service.ExerciseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ExerciseServiceImpl implements ExerciseService {
    private ExerciseDao exerciseDao;

    @Autowired
    public void setExerciseDao(ExerciseDao exerciseDao) {
        this.exerciseDao = exerciseDao;
    }


    public int insertQuestion(Question question) {
        return exerciseDao.insertQuestion(question);
    }

    public int deleteQuestion(Question question) {
        return exerciseDao.deleteQuestion(question);
    }

    public int updateQuestion(Question question) {
        return exerciseDao.updateQuestion(question);
    }

    public List<Exercise> getAllQuestionById(int exerciseId) {
        return exerciseDao.getAllQuestionById(exerciseId);
    }

    public List<Exercise> getAllExercises() {
        return exerciseDao.getAllExercises();
    }

    public int insertExercise(Exercise exercise) {
        return exerciseDao.insertExercise(exercise);
    }

    public void deleteExercise(int exercise_id) {
        exerciseDao.deleteExercise(exercise_id);
    }

    public Question getQuestionById(int question_id) {
        return exerciseDao.getQuestionById(question_id);
    }


}
